﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Whir.Common.WebHelper;
using System.Collections.Specialized;
using System.Text.RegularExpressions;

public partial class Whir_System_Module_InfoType_ContentManage : System.Web.UI.Page
{
    protected int TypeID, ModelID, ModelFormID,ParentID;
    protected string Where;
    protected string key;

    protected void Page_Load(object sender, EventArgs e)
    {
        RoleHelper.IsLogin();    //登录判断

        key = Whir.Common.Settings.GetString("AdminCacheKey");
        ModelID = NetRequest.GetQueryInt("ModelID");
        ModelFormID = NetRequest.GetQueryInt("ModelFormID");
        TypeID = NetRequest.GetQueryInt("TypeID");
        ParentID = NetRequest.GetQueryInt("ParentID");

        if (ParentID == 0) ParentID = 1;

        if (!IsPostBack)
        {
            if (TypeID != 0)
            {

                //初始化内容管理条件
                Where = " TypeID =" + TypeID;
                //if (ParentID != 0)
                //{
                    Where += " AND ParentID=" + ParentID;
                //}
                CommonContentManage1.ParentID = ParentID;
                CommonContentManage1.ModelID = ModelID;
                CommonContentManage1.ModelFormID = ModelFormID;
                CommonContentManage1.TypeID = TypeID;
                CommonContentManage1.Where = Where;
                CommonContentManage1.Settings = "";

                Whir.BLL.Whir_Column bll = new Whir.BLL.Whir_Column();
                Whir.Model.Whir_Column model = bll.GetModel(TypeID);
                lbColumnName.Text = model.columnName;
            }
        }
    }

    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        Whir.Log.Model.Whir_OperateLog model = new Whir.Log.Model.Whir_OperateLog();
        model.title = "退出";
        model.operateType = 6;      //退出
        model.operateResult = true;
        model.operateDesc = "退出";

        Whir.Log.OperateLog.Add(model);

        HttpContext.Current.Response.Cookies.Remove(key);

        Response.Redirect("~/Whir_system/login.aspx");
        return;
    }
}
